home *** CD-ROM | disk | FTP | other *** search
- Path: oxy.rust.net!usenet
- From: ebennett@rust.net
- Newsgroups: comp.lang.c++
- Subject: Re: Pointers to functions
- Date: Thu, 11 Jan 1996 05:15:20 GMT
- Organization: Rust Net - High Speed Internet in Detroit 810-642-2276
- Message-ID: <4d1rph$ski@oxy.rust.net>
- References: <4cprlp$6kl@jupiter.planet.net>
- NNTP-Posting-Host: liv-16.rust.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Chris Kemp <chrisk@paladn.com> wrote:
-
- >Can I do this?
- >I want user to enter a function name, then the program will
- >'do' the function named by the user
-
- >char *name="home_fn";
- >int g;
- >int a=2;
- >int b=4;
-
- This can be done easily under Windows, if the functions are in a DLL.
- The program would use GetProcAddress() to get a pointer to the
- fucntion specified, and then call it through that pointer.
-
- If the functions are not in a DLL, then you would need a table of
- function names and addresses. You would run through the table looking
- for the name entered by the user, and then call the procedure through
- the pointer stored in the table.
-
- Earl Bennett
-
-
-